package com.atguigu.springcloud.service;

import com.atguigu.springcloud.common.CommonResult;
import com.atguigu.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @InterfaceName : com.atguigu.springcloud.service.OpenFeignPaymentService
 * @Description : 接口描述
 * Created by cyd on 2021-10-05 20:34:20
 */
@Component
// 定义该类是服务调用接口，并指明从哪个微服务调用
@FeignClient(value = "CLOUD-PAYMENT-SERVICE")
public interface OpenFeignPaymentService {

    // 规范调用的是哪个方法的接口，这里和SpringMvc采用相同的规范
    @GetMapping("/payment/get/{id}")
    CommonResult<Payment> getPayment(@PathVariable("id") Long id);

    // 超时控制测试
    @GetMapping("/payment/feignTimeout")
    public String feignTimeout();
}
